<div id="view<?php echo $uniqid;?>" style="padding-top: 20px; padding-bottom: 20px;" class="dianpuWithdrawView">
    <table>
        <tr>
            <td colspan="2" class="header">店铺提现状态</td>
        </tr>
        <tr>
            <td><label>记录ID：</label><span>{{params.id}}</span></td>
            <td><label>状态：</label><span :class="'status_'+params.status">{{params.status_name}}</span></td>
        </tr>
        <tr v-if="params.status > 1">
            <td colspan="2" class="header">打款凭证</td>
        </tr>
        <tr v-if="params.status > 1">
            <td colspan="2">
                <template v-if="params.paidoff_evidence_image.length">
                    <div onclick="dianpuWithdrawImageDialog()" style="cursor: pointer; color: #0C5AEB;">查看大图</div>
                    <div style="display: flex; width: 100%;  flex-wrap:wrap;">
                        <img v-for="(image, index) in params.paidoff_evidence_image" :src="image" style="width: 18%; height: auto; padding-right: 2%;">
                    </div>
                </template>

                <label v-else>暂无凭证</label>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="header">提现金额</td>
        </tr>
        <tr>
            <td><label>{{params.status > 1?"实际到帐":"应付款"}}：</label><span style="color: #c17608; font-size: 1.1em;">{{params.actual_money}}元</span></td>
            <td><label>提现金额：</label><span>{{params.money}}元</span></td>
        </tr>
        <tr>
            <td><label>提现手续费：</label><span>{{params.charge_money}}元</span></td>
            <td><label>手续费费率：</label><span>{{params.service_fee}}%</span></td>
        </tr>
        <tr>
            <td colspan="2" style="padding-top:5px; padding-bottom: 5px;">
                <div style="line-height: 24px;">
                    <label>提现备注：</label>{{params.remark?params.remark:'暂无备注'}}
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="header">收款帐户信息</td>
        </tr>
        <tr>
            <td><label>收款方式：</label><span>{{params.withdraw_type_name}}</span></td>
            <td><label>帐户名称：</label><span>{{params.withdraw_type=='weixin'?params.withdraw_info_array['微信用户']:params.withdraw_info_array['真实姓名']}}</span></td>
        </tr>
        <tr>
            <td colspan="2"><label>帐号：</label><span>{{params.withdraw_type=='bank'?params.withdraw_info_array['银行卡号']:(params.withdraw_type=='weixin'?params.withdraw_info_array['微信ID']:params.withdraw_info_array['支付宝账户'])}}</span></td>
        </tr>
        <tr v-if="params.withdraw_type === 'bank'">
            <td><label>开户行：</label>{{params.withdraw_info_array['开户行']}}</td>
            <td style="line-height: 24px;"><label>支行：</label>{{params.withdraw_info_array['省']}}{{params.withdraw_info_array['市']}}{{params.withdraw_info_array['支行名称']}}</td>
        </tr>
        <tr>
            <td colspan="2" class="header">申请人信息</td>
        </tr>
        <tr>
            <td style="line-height: 24px;"><label>申请人昵称：</label><span>{{params.member?params.member.nickname:'暂无'}}</span>(申请人ID：<span>{{params.member_id}}</span>)</td>
            <td>
                <label>申请人电话：</label><span>{{params.member?params.member.phone:'暂无'}}</span>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="header">店铺信息</td>
        </tr>
        <tr>
            <td><label>企业ID：</label><span>{{params.dianpu_id}}</span></td>
            <td style="line-height: 24px;"><label>企业名称：</label><span>{{params.dianpu.company_name}}</span></td>
        </tr>
        <tr>
            <td><label>企业联系电话：</label><span>{{params.dianpu.phone}}</span></td>
            <td><label>企业法人：</label><span>{{params.dianpu.company_representative_name}}</span></td>
        </tr>
        <tr>
            <td style="line-height: 24px;"><label>掌柜昵称：</label><span>{{params.dianpumanager.nickname}}</span>(掌柜ID：<span>{{params.dianpu_manager_id}}</span>)</td>
            <td><label>掌柜电话：</label><span>{{params.dianpumanager.phone}}</span></td>
        </tr>
        <tr>
            <td colspan="2" class="header">操作日志信息</td>
        </tr>
        <tr>
            <td colspan="2">
                <div class="block" style="padding: 10px 0;">
                    <el-timeline>
                        <el-timeline-item :timestamp="log.created_at" placement="top"  v-for="(log, index) in params.dianpuwithdrawlogs">
                            <el-card :body-style="{padding:'10px'}">
                                <h4 style="line-height: 1.2em;">
                                    <span style="margin-right: 40px;">{{log.event_name}}</span>
                                    <i style="font-weight: normal; font-size: 1em; font-style: normal;">操作人：{{log.oper_type_user}}[{{log.oper_type_text}}]</i>
                                </h4>
                                <p style="line-height: 20px; margin-top: 5px;">{{log.remark}}</p>
                            </el-card>
                        </el-timeline-item>
                    </el-timeline>
                </div>
            </td>
        </tr>
    </table>
</div>
<div id="dianpuWithdrawviewdlg" class="easyui-dialog" style="width:840px; height:520px;" title="信息框" closed="true"></div>
<script>
    var dianpuWithdrawViewVm = new Vue({
        el: '#view<?php echo $uniqid;?>',
        data: {
            params: JSON.parse('<?php echo addslashes($dataset);?>'),
        },
        methods: {
            doAgree:function () {
                let that = this;
                $.messager.confirm('提示', '<span style="color: #36c705; font-weight: bold; font-size: 1.1em;">确定 同意当前的店铺提现申请？</span>', function (r) {
                    if(r){
                        $.messager.progress();
                        $.post('/admin/dianpuwithdraw/doagree', {id: that.params.id}, function (data) {
                            $.messager.progress('close');
                            if (data.ret === 0) {
                                $.messager.show({
                                    title: '提示',
                                    msg: data.msg,
                                    timeout: 3000,
                                    showType: 'slide'
                                });
                                $("#dianpuwithdrawdlg").dialog('close');
                                dianpuwithdrawReload(true);
                            } else {
                                $.messager.alert('提示', data.msg, 'error');
                            }
                        }, 'json');
                    }
                });
            },
            doRefuse:function () {
                let that = this;
                $.messager.confirm('提示', '<span style="color: #aa0303; font-weight: bold; font-size: 1.1em;">确定 拒绝当前的店铺提现申请？</span>', function (r) {
                    if (r) {
                        $.messager.prompt('拒绝用户提现提示', '请输入拒绝原因！', function (remark){
                            if('undefined' !== typeof(remark)){
                                let new_remark = (remark.length === 0)?'':remark;
                                $.messager.progress();
                                $.post('/admin/dianpuwithdraw/dorefuse', {id: that.params.id, remark: new_remark}, function (data) {
                                    $.messager.progress('close');
                                    if (data.ret === 0) {
                                        $.messager.show({
                                            title: '提示',
                                            msg: data.msg,
                                            timeout: 3000,
                                            showType: 'slide'
                                        });
                                        $("#dianpuwithdrawdlg").dialog('close');
                                        dianpuwithdrawReload(true);
                                    } else {
                                        $.messager.alert('出错', data.msg, 'error');
                                    }
                                }, 'json');
                            }
                        });
                    }
                });
            },
            doBackRefuse:function () {
                let that = this;
                $.messager.confirm('提示', '<span style="color: #ba5002; font-weight: bold; font-size: 1.1em;">确定 要把当前提现申请的状态从同意设置为拒绝？</span>', function (r) {
                    if (r) {
                        $.messager.prompt('拒绝用户提现提示', '请输入拒绝原因！', function (remark){
                            if('undefined' !== typeof(remark)){
                                let new_remark = (remark.length === 0)?'':remark;
                                $.messager.progress();
                                $.post('/admin/dianpuwithdraw/dorefuse', {id: that.params.id, re:1, remark: new_remark}, function (data) {
                                    $.messager.progress('close');
                                    if (data.ret === 0) {
                                        $.messager.show({
                                            title: '提示',
                                            msg: data.msg,
                                            timeout: 3000,
                                            showType: 'slide'
                                        });
                                        $("#dianpuwithdrawdlg").dialog('close');
                                        dianpuwithdrawReload(true);
                                    } else {
                                        $.messager.alert('出错', data.msg, 'error');
                                    }
                                }, 'json');
                            }
                        });
                    }
                });
            },
            doPaid:function () {
                let that = this;
                $.messager.confirm('提示', '<span style="color: #e800f8; font-weight: bold; font-size: 1.1em;">确定 店铺掌柜已打款给提现申请人，操作后提现款项立即到达店铺掌柜帐户？</span>', function (r) {
                    if(r){
                        $.messager.progress();
                        $.post('/admin/dianpuwithdraw/dopaid', {id: that.params.id}, function (data) {
                            $.messager.progress('close');
                            if (data.ret === 0) {
                                $.messager.show({
                                    title: '提示',
                                    msg: data.msg,
                                    timeout: 3000,
                                    showType: 'slide'
                                });
                                $("#dianpuwithdrawdlg").dialog('close');
                                dianpuwithdrawReload(true);
                            } else {
                                $.messager.alert('提示', data.msg, 'error');
                            }
                        }, 'json');
                    }
                });
            },
            doBackAgree:function () {
                let that = this;
                $.messager.confirm('提示', '<span style="color: #032ccb; font-weight: bold; font-size: 1.1em;">确定 确定打款凭证无效，重新设置状态为同意？</span>', function (r) {
                    if(r){
                        $.messager.progress();
                        $.post('/admin/dianpuwithdraw/doagree', {id: that.params.id, re:1}, function (data) {
                            $.messager.progress('close');
                            if (data.ret === 0) {
                                $.messager.show({
                                    title: '提示',
                                    msg: data.msg,
                                    timeout: 3000,
                                    showType: 'slide'
                                });
                                $("#dianpuwithdrawdlg").dialog('close');
                                dianpuwithdrawReload(true);
                            } else {
                                $.messager.alert('提示', data.msg, 'error');
                            }
                        }, 'json');
                    }
                });
            },
        }
    });
    var dianpuWithdrawImageDialog = function () {
        $("#dianpuWithdrawviewdlg").dialog({
            title: "打款凭证查看",
            closed: false,
            width: 640,
            height: 600,
            cache: false,
            href: '/admin/dianpuwithdraw/showpic?id='+dianpuWithdrawViewVm.params.id,
            modal: true,
            buttons: [{
                text: '关闭',
                iconCls: 'icon-no',
                handler: function () {
                    $("#dianpuWithdrawviewdlg").dialog('close');
                }
            }]
        });
    }
    $(function () {
        $('#dianpuwithdrawAgree').click(function () {
            dianpuWithdrawViewVm.doAgree();
        });
        $('#dianpuwithdrawRefuse').click(function () {
            dianpuWithdrawViewVm.doRefuse();
        });
        $('#dianpuwithdrawBackRefuse').click(function () {
            dianpuWithdrawViewVm.doBackRefuse();
        });
        $('#dianpuwithdrawPaid').click(function () {
            dianpuWithdrawViewVm.doPaid();
        });
        $('#dianpuwithdrawBackAgree').click(function () {
            dianpuWithdrawViewVm.doBackAgree();
        });
    });
</script>
<style>
    .dianpuWithdrawView table{
        width: 96%;
        margin:0 auto;
        border-top: 1px solid #cecece;
        border-left: 1px solid #cecece;
    }
    .dianpuWithdrawView table td{
        width: 50%;
        padding: 0 10px;
        line-height: 38px;
        border-right: 1px solid #cecece;
        border-bottom: 1px solid #cecece;
    }

    .dianpuWithdrawView table td.header{
        font-size: 1.2em;
        font-weight: bold;
        background-color: #d7d7d7;
    }

    .dianpuWithdrawView label{
        font-weight: bold;
        margin-right: 10px;
    }
    .dianpuWithdrawView .status_-2{
        color: #000000;
    }
    .dianpuWithdrawView .status_-1{
        color: #bd0101;
    }
    .dianpuWithdrawView .status_0{
        color: #0e50f1;
    }
    .dianpuWithdrawView .status_1{
        color: #ee650c;
    }
    .dianpuWithdrawView .status_2{
        color: #0eb913;
    }
    .dianpuWithdrawView .status_3{
        color: #8a0090;
    }
</style>
